import { HttpMethods } from '@/http/';
/**
 * RequestParams<Type> 请求参数
 * ResponseData<Type> 响应体
 * URL API路径
**/
export namespace UserApi {
    type GetParams = {
        id: number
        username: string
        ageRange: [0, 10]
    }
    type PostParams = {
        username: string
        password: string
    }
    type GetResponseData = {
        code: number
        data: Array<Record<string, string>>
    }
    type PostResponseData = { code: number, msg: string }
    export const URL = "/user"
    export type Params<M extends Methods> = M extends HttpMethods.GET ? GetParams : M extends HttpMethods.POST ? PostParams : never
    export type ResponseData<M extends Methods> = M extends HttpMethods.GET ? GetResponseData : M extends HttpMethods.POST ? PostResponseData : never
    export type Methods = HttpMethods.POST | HttpMethods.GET
}

export namespace UserInfoApi {
    export type ResponseData = {
        code:number
        data:{
            username:string,
            level:number,
            id:number
        }
    }
    export const URL ="http://192.168.1.63:8080" + "/v1/user/info";
}